widget: Avoid typechecks when accessing ->clip and ->allocation
authorAlexander Larsson <alexl@redhat.com>
Wed, 11 Jan 2017 14:30:30 +0000 (15:30 +0100)
committerAlexander Larsson <alexl@redhat.com>
Wed, 11 Jan 2017 14:30:30 +0000 (15:30 +0100)
gtk/gtkwidget.c

index 99bb345ddfb515ab0a02d5e3a0bb2542fd17a57c..fc5edbc8890c8baedef05036acaa9a8aaa9537cc 100644 (file)
@@ -5124,18 +5124,18 @@ gtk_widget_queue_draw_area (GtkWidget *widget,
 void
 gtk_widget_queue_draw (GtkWidget *widget)
 {
-  GdkRectangle rect;
+  GdkRectangle *rect;
 
   g_return_if_fail (GTK_IS_WIDGET (widget));
 
-  gtk_widget_get_clip (widget, &rect);
+  rect = &widget->priv->clip;
 
   if (!_gtk_widget_get_has_window (widget))
     gtk_widget_queue_draw_area (widget,
-                                rect.x, rect.y, rect.width, rect.height);
+                                rect->x, rect->y, rect->width, rect->height);
   else
     gtk_widget_queue_draw_area (widget,
-                                0, 0, rect.width, rect.height);
+                                0, 0, rect->width, rect->height);
 }
 
 static void
@@ -15586,19 +15586,19 @@ gtk_widget_snapshot (GtkWidget   *widget,
                      GtkSnapshot *snapshot)
 {
   GtkWidgetClass *klass = GTK_WIDGET_GET_CLASS (widget);
+  GtkWidgetPrivate *priv;
   graphene_rect_t bounds;
   GtkCssValue *filter_value;
-  GtkAllocation clip;
-  GtkAllocation alloc;
   RenderMode mode;
   double opacity;
 
   if (_gtk_widget_get_alloc_needed (widget))
     return;
 
-  gtk_widget_get_clip (widget, &clip);
-  _gtk_widget_get_allocation (widget, &alloc);
-  graphene_rect_init (&bounds, clip.x - alloc.x, clip.y - alloc.y, clip.width, clip.height);
+  priv = widget->priv;
+  graphene_rect_init (&bounds, priv->clip.x - priv->allocation.x,
+                      priv->clip.y - priv->allocation.y,
+                      priv->clip.width, priv->clip.height);
   if (gtk_snapshot_clips_rect (snapshot, &bounds))
     return;